home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <dir.h>
- #include <string.h>
-
- main(argc,argv)
- int argc;
- char *argv[64];
- {
-
- struct ffblk ffblk;
- int done,i,j,k;
- static char pass;
- FILE *infp,*outfp;
- char path1[64],path2[64];
- char aline[120],password[64];
-
-
- if(argc<2) usage();
- infp=fopen(argv[1],"r");
- if (argc==3) outfp=fopen(argv[2],"w");
- else outfp=fopen("\\OPUS\\MISC\\OKFILE.LST","w");
- if (outfp == NULL) usage();
- if (infp == NULL) usage();
- while (fgets(aline,120,infp)){
- if ((strspn("!",aline))!=0){
- sscanf(aline,"%s %s",path1,password);
- pass='Y';
- k=strlen(path1);
- }
- if ((strspn("!",aline)) == 0){
- strcpy(path1,aline);
- k=strlen(path1)-1;
- pass='N';
- }
-
- path1[k]='\0';
- for (i=0;i<k;i++) if (path1[i]=='\\')j=i;
- for (i=0;i<=j;i++) path2[i]=path1[i];
- path2[i]='\0';
- printf("%s",aline);
- done=findfirst(path1,&ffblk,0);
- while (!done){
- if (pass=='Y') fprintf(outfp,"%s%s %s\n",path2,ffblk.ff_name,password);
- if (pass=='N') fprintf(outfp,"%s%s\n",path2,ffblk.ff_name);
- done=findnext(&ffblk);
- }
- }
- fclose(infp);
- fclose(outfp);
- exit(0);
- }
-
- usage()
- {
- printf("\n\n\n\n To Use:\n\n");
- printf("OKFILE INFILE.EXT [OUTFILE.EXT]\n\n");
- printf("Where INFILE.EXT is a list of directories/files that are file-requestable \n");
- printf("on your system. Wildcards are allowed. Each line of should be like:\n");
- printf(" C:\\Opus\\Files\\Ms-Dos\\*.* \n C:\\Opus\\Files\\Opusbbs\\O???_000.arc\n\n");
- printf("OUTFILE.EXT is the filename from OPUS.CTL for OKFILE.LST, and the default \n");
- printf("is '\\Opus\\Misc\\OKFILE.LST'.\n\n");
- exit(1);
- }
-